<script setup>
import { computed, onMounted, onUnmounted, reactive, ref } from 'vue'
const dateFork=reactive({
    hours:0,
    minutes:0,
    seconds:0
})
// 获取时间
const getTime=()=>{
    const now=new Date()
    dateFork.hours=now.getHours()
    dateFork.minutes=now.getMinutes()
    dateFork.seconds=now.getSeconds()
}
const fillZero=(num)=>{
    return num<10?`0${num}`:num
}
onMounted(()=>{
    setInterval(()=>{
        getTime()
    },1000)
})
onUnmounted(()=>{
    clearInterval()
})

</script>

<template>
    <div class="min-card">
        <div class="time-box">
            <img src="/images/xk.jpg" alt="bkg" class="bkg">
            <div class="time">
                <li>
                    <span>{{ fillZero(dateFork.hours)}}</span>
                    <span>hours</span>
                </li>
                <li>
                    <span>{{ fillZero(dateFork.minutes)}}</span>
                    <span>minutes</span>
                </li>
                <li>
                    <span>{{  fillZero(dateFork.seconds)}}</span>
                    <span>seconds</span>
                </li>
            </div>
        </div>
        <div class="sketch">
            <p>Lin6x Blog</p>
            <p>游戏、虚幻引擎、前端编程，这是博主的三大标签。本站主要记录博主的学习、遇到的问题、自己所总结的知识，也会分享一些日常心得~</p>
        </div>
        <div class="min-category">
            <li>
                <span>文章</span>
                <span>60</span>
            </li>
            <li>
                <span>标签</span>
                <span>30</span>
            </li>
            <li>
                <span>留言</span>
                <span>20</span>
            </li>
            <li>
                <span>访问</span>
                <span>100</span>
            </li>
        </div>
    </div>
</template>

<style lang="scss" scoped>
// 卡片载入动画
@keyframes cardIn {
    0% {
        transform: translate(0, -20%);
    }
    100% {
        transform: translate(0, 0);
    }
}
/* 卡片样式开始 */
.min-card {
    height: 306px;
    min-width: 220px;
    width: 250px;
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 2px rgba(0, 0, 0, .2);
    transition: .5s;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
    animation:  cardIn .5s ease-in-out;

    .time-box {
        width: 100%;
        height: 130px;
        position: relative;
        padding: 0;
        overflow: hidden;

        .bkg {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: .5s ease-in-out;

        }

        &:hover .bkg {
            filter: blur(5px);
        }

        .time {
            padding: 0 20px;
            /* background-image: url(../images/xk.jpg); */
            background-size: cover;
            background-position: center;
            transition: .5s;
            color: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
            text-align: center;
            height: 130px;
            width: 100%;
            transition: .5s linear;

            li {
                position: relative;
                height: 100%;
                flex: 1;
                display: flex;
                flex-direction: column;
                justify-content: space-around;
                margin: 0 10px;

                :first-child {
                    font-size: 36px;
                }

                :last-child {
                    font-size: 12px;
                }
            }

            li:nth-child(1)::after,
            li:nth-child(2)::after {
                content: ':';
                position: absolute;
                right: -15px;
                top: 20px;
                font-size: 30px;
            }
        }
    }

    /*  */
    .sketch {
        /* height: 116px; */
        height: 116px;
        width: 100%;

        :first-child {
            color: #08D9D6;
            font-size: 16px;
            font-weight: 600;
            padding: 8px 16px;
        }

        :last-child {
            font-size: 14px;
            color: #000000;
            padding: 0px 8px;
        }
    }

    /*  */
    /*  */
    .min-category {
        display: flex;
        height: 56px;
        width: 100%;
        border-top: 1px solid #f2f2f2;
        justify-content: space-between;
        align-items: center;
        color: #999999;
        font-size: 14px;
        transition: .5s;

        li {
            height: 56px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            flex: 1;
            cursor: pointer;
            border-right: 1px solid #f2f2f2;

            :last-child {
                margin-top: 8px;
                font-size: 12px;
                color: #000;
            }

            &:last-child {
                border-right: none;


            }

            :hover {
                color: #08D9D6;
            }
        }
    }

    /*  */

}
</style>